<template>
	<view class="order-prod2-page">
		<TopBar
			left-icon="/static/user.png"
			scan-icon="/static/saoyisao.png"
			menu-icon="/static/menu.png"
			@menu="toggleMenu"
		/>

		<scroll-view scroll-y class="form-scroll">
			<!-- 返回箭头独立一行 -->
			<view class="back-row" @click="goBack">
				<image class="back-arrow-icon" src="/static/left.png" mode="aspectFit" />
			</view>

			<view class="header">
				<text class="title">Order info</text>
				<text class="subtitle">Section 2. Production Information</text>
			</view>

			<!-- Style number -->
			<view class="field">
				<text class="label">Style number</text>
				<view class="input"><input v-model="styleNo" placeholder="46DC85241-143" /></view>
			</view>

			<!-- Product -->
			<view class="field">
				<text class="label">Product</text>
				<picker mode="selector" :range="products" @change="(e)=>selectedProduct=e.detail.value">
					<view class="select"><text class="select-text">{{ products[selectedProduct] }}</text><image class="chev-icon" src="/static/down.png" /></view>
				</picker>
			</view>

			<!-- Principale material -->
			<view class="field">
				<text class="label">Principale material</text>
				<picker mode="selector" :range="materials" @change="(e)=>selectedMain=e.detail.value">
					<view class="select"><text class="select-text">{{ materials[selectedMain] }}</text><image class="chev-icon" src="/static/down.png" /></view>
				</picker>
			</view>

			<!-- Percentage -->
			<view class="field">
				<view class="input"><input placeholder="100%" v-model="percentage" /></view>
			</view>

			<!-- Material 2 -->
			<view class="field">
				<text class="label">Material 2</text>
				<view class="input"><input placeholder="" v-model="material2" /></view>
			</view>

			<!-- Accessory -->
			<view class="field">
				<text class="label">Accessory</text>
				<picker mode="selector" :range="accessories" @change="(e)=>selectedAccessory=e.detail.value">
					<view class="select"><text class="select-text">{{ accessories[selectedAccessory] }}</text><image class="chev-icon" src="/static/down.png" /></view>
				</picker>
			</view>

			<!-- Material -->
			<view class="field">
				<text class="label">Material</text>
				<picker mode="selector" :range="materials" @change="(e)=>selectedMaterial=e.detail.value">
					<view class="select"><text class="select-text">{{ materials[selectedMaterial] }}</text><image class="chev-icon" src="/static/down.png" /></view>
				</picker>
			</view>

			<button class="confirm-btn" @click="goPerson">Confirm</button>
		</scroll-view>

		<CustomTabbar active="home" />

		<AccountMenu
			v-if="showMenu"
			:style="{ '--anchor-top': '70px', '--anchor-right': '16px' }"
			@close="closeMenu"
			@select="closeMenu"
		/>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import TopBar from '@/components/TopBar.vue';
import AccountMenu from '@/components/AccountMenu.vue';
import CustomTabbar from '@/components/CustomTabbar.vue';

const showMenu = ref(false);
const toggleMenu = () => { showMenu.value = !showMenu.value; };
const closeMenu = () => { showMenu.value = false; };
const goBack = () => {
	uni.navigateTo({ url: '/pages/home/order-production' });
};

const styleNo = ref('46DC85241-143');
const products = ref(['T-shirt','Sweater','Jacket']);
const selectedProduct = ref(0);
const materials = ref(['Cotton','Wool','Polyester']);
const selectedMain = ref(0);
const percentage = ref('');
const material2 = ref('');
const accessories = ref(['Buttons','Zipper','Label']);
const selectedAccessory = ref(0);
const selectedMaterial = ref(0);

const goPerson = () => {
    uni.reLaunch({ url: '/pages/person/person' });
};
</script>

<style lang="scss">
.order-prod2-page { min-height: 100vh; background: linear-gradient(180deg, #d9f0ff 0%, #e9f9ed 100%); }
.form-scroll { margin-top: 60px; padding: 0 16px 84px 16px; box-sizing: border-box; }
.back-row { margin: 12px 0 0 -8px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.back-arrow-icon { width: 24px; height: 24px; }
.header { margin-bottom: 12px; }
.title { font-size: 22px; font-weight: 800; color: #0b1e2a; }
.subtitle { display: block; margin-top: 6px; color: #3b5560; font-size: 14px; }

.field { margin-top: 14px; }
.label { font-size: 14px; color: #0b1e2a; margin-bottom: 8px; display: block; }
.input { height: 44px; background: #fff; border-radius: 10px; display: flex; align-items: center; padding: 0 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.input input { flex: 1; height: 100%; border: none; outline: none; font-size: 14px; color: #333; }

.select { height: 44px; background: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.select-text { color: #333; font-size: 14px; }
.chev-icon { width: 14px; height: 14px; margin-left: 8px; opacity: .8; }

.confirm-btn { margin: 24px 0 24px; width: 100%; height: 44px; background: #222; color: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
</style>


